package fejezet20;

import java.awt.*;
import java.awt.event.*;
import javax.swing.JApplet;

public class EgérHelye1 extends JApplet
    implements MouseMotionListener {
  private int x, y;                                     //1

  @Override
  public void init() {
    addMouseMotionListener(this);                       //2
  }

  @Override
  public void paint(Graphics g) {                       //3
    g.clearRect(
      0, 0, getBounds().width, getBounds().height);     //4
    g.setColor(Color.BLUE);                             //5
    g.drawString("("+x+"; "+y+")", x, y);               //6
  }

  public void mouseDragged(MouseEvent e) {              //7
    ;
  }

  public void mouseMoved(MouseEvent e) {                //8
    x=e.getX();                                         //9
    y=e.getY();                                        //10
    repaint();                                         //11
  }
}